﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Products.aspx.cs" Inherits="Sbook.AdminIstrator.Products" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Src="~/AdminIstrator/ControlAdmin/MenuLeft.ascx" TagName="MenuLeft"
    TagPrefix="UC" %>
<%@ Register Src="~/Control/Menu/MenuRight.ascx" TagName="MenuRight" TagPrefix="UC" %>
<%@ Register Src="ControlAdmin/ucLogout.ascx" TagName="ucLogout" TagPrefix="uc1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Manager Products</title>
    <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/ddaccordion.js"></script>
    <script type="text/javascript">
        ddaccordion.init({
            headerclass: "submenuheader", //Shared CSS class name of headers group
            contentclass: "submenu", //Shared CSS class name of contents group
            revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
            mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
            collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
            defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
            onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
            animatedefault: false, //Should contents open by default be animated into view?
            persiststate: true, //persist state of opened contents within browser session?
            toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
            togglehtml: ["suffix", "<img src='images/plus.gif' class='statusicon' />", "<img src='images/minus.gif' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
            animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
            oninit: function (headers, expandedindices) { //custom code to run when headers have initalized
                //do nothing
            },
            onopenclose: function (header, index, state, isuseractivated) { //custom code to run whenever a header is opened or closed
                //do nothing
            }
        })
    </script>
    <script src="js/jquery.jclock-1.2.0.js.txt" type="text/javascript"></script>
    <script type="text/javascript" src="js/jconfirmaction.jquery.js"></script>
    <script type="text/javascript">

        $(document).ready(function () {
            $('.ask').jConfirmAction();
        });
	
    </script>
    <script type="text/javascript">
        $(function ($) {
            $('.jclock').jclock();
        });


    </script>
    <script language="javascript" type="text/javascript" src="js/niceforms.js"></script>
    <link rel="stylesheet" type="text/css" media="all" href="css/niceforms-default.css" />
</head>
<body>
    <form runat="server" id="form1">
    <div id="main_container">
        <div class="header">
            <div class="logo">
                <a href="adminsys.aspx">
                    <img alt="" src="../images/logo_sach.gif" width="130" height="100" border="0" /></a></div>
            <div class="right_header">
                <%=Username%>, <a href="#">Visit site</a> | <a href="#" class="messages">(3) Messages</a>
                |
                <%--<a href="#" class="logout">Logout</a>--%><uc1:ucLogout ID="ucLogout1" runat="server" />
            </div>
            <div class="jclock">
            </div>
        </div>
        <div class="main_content">
            <div class="menu">
                <ul>
                    <li><a class="current" href="#">Admin Home</a></li>
                    <li><a href="#">Danh Mục</a>
                        <ul>
                            <li><a href="" title="">Danh Mục 1</a></li>
                            <li><a href="" title="">Danh Mục 1</a></li>
                            <li><a href="" title="">Danh Mục 1</a></li>
                            <li><a href="" title="">Danh Mục 1</a></li>
                            <li><a href="" title="">Danh Mục 1</a></li>
                        </ul>
                    </li>
                    <li></li>
                    <li><a href="">Danh Mục 2</a></li>
                </ul>
            </div>
            <div class="center_content">
                <UC:MenuLeft runat="server" ID="MenuRight"></UC:MenuLeft>
                <div class="right_content">
                    <h2>
                        Manager Products</h2>
                    <asp:Panel runat="server" ID="pnView" BorderStyle="none" Visible="true">
                        <asp:DataGrid runat="server" ID="grdProducts" BorderStyle="Solid" Width="100%" ItemStyle-Font-Size="12px"
                            ItemStyle-Height="25px" HeaderStyle-Height="30px" AllowPaging="True" PageSize="5"
                            PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Center" AutoGenerateColumns="false"
                            OnItemCommand="grdProducts_ItemCommand" OnItemDataBound="grdProducts_ItemDatabound"
                            OnPageIndexChanged="grdProducts_PageIndexChanged">
                            <HeaderStyle BackColor="#0E4354" ForeColor="White" HorizontalAlign="Center" Font-Bold="true" />
                            <Columns>
                                <asp:TemplateColumn ItemStyle-HorizontalAlign="Center">
                                    <HeaderTemplate>
                                        Chọn</HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox runat="server" ID="chkSelect" />
                                    </ItemTemplate>
                                </asp:TemplateColumn>
                                <asp:BoundColumn DataField="PId" HeaderText="ID" Visible="false"></asp:BoundColumn>
                                <asp:BoundColumn DataField="PCode" HeaderText="Code" Visible="true"></asp:BoundColumn>
                                <asp:BoundColumn DataField="PName" HeaderText="Tên sách" Visible="true"></asp:BoundColumn>
                                <asp:TemplateColumn>
                                    <HeaderTemplate>
                                        Hình ảnh</HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:Image runat="server" Width="80px" Height="80px" ID="imgBook" ImageUrl='<%#DataBinder.Eval(Container.DataItem,"PImg") %>' />
                                    </ItemTemplate>
                                </asp:TemplateColumn>
                                <asp:BoundColumn DataField="PPrice" HeaderText="Giá bán" ItemStyle-HorizontalAlign="Right"
                                    Visible="true"></asp:BoundColumn>
                                <asp:BoundColumn DataField="PSaleOff" HeaderText="Giảm giá" ItemStyle-HorizontalAlign="Center"
                                    Visible="true"></asp:BoundColumn>
                                <asp:BoundColumn DataField="PUId" HeaderText="Nhà xuất bản" Visible="true"></asp:BoundColumn>
                                <asp:BoundColumn DataField="CatId" HeaderText="Danh mục" Visible="true"></asp:BoundColumn>
                                <asp:BoundColumn DataField="AId" HeaderText="Tác giả" Visible="false"></asp:BoundColumn>
                                <asp:BoundColumn DataField="PAuthor" HeaderText="Tác giả" Visible="true"></asp:BoundColumn>
                                <asp:BoundColumn DataField="PActive" HeaderText="Trạng thái" Visible="true" ItemStyle-HorizontalAlign="Center">
                                </asp:BoundColumn>
                                <asp:TemplateColumn>
                                    <HeaderTemplate>
                                        Chức năng</HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:LinkButton runat="server" ID="lbtEdit" Text="Edit" CommandName="Edit" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"PId") %>'></asp:LinkButton>
                                        <asp:LinkButton runat="server" ID="lbtDelete" Text="Delete" OnClientClick="javascript:return confirm('Bạn muốn xóa?');"
                                            CommandName="Delete" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"PId") %>'></asp:LinkButton>
                                        <asp:LinkButton runat="server" ID="lbtActive" Text="" CommandName="Active" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"PId") %>'></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateColumn>
                            </Columns>
                        </asp:DataGrid>
                        <table>
                            <tr>
                                <td>
                                    <asp:Button runat="server" ID="btnAdd" OnClick="Add_Click" Text="Add" />
                                    <asp:Button runat="server" ID="btnDelete" OnClick="Delete_Click" OnClientClick="javascript:return confirm('Bạn muốn xóa?');"
                                        Text="Delete" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <asp:Panel runat="server" ID="pnUpdate" HorizontalAlign="Left" Visible="false">
                        <table style="float: left">
                            <tr>
                                <th>
                                    <asp:Label runat="server" ID="lblPUId" Text="Nhà xuất bản :"></asp:Label>
                                </th>
                                <td>
                                    <asp:DropDownList runat="server" ID="ddlPublish">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <asp:Label runat="server" ID="lblCate" Text="Danh mục :"></asp:Label>
                                </th>
                                <td>
                                    <asp:DropDownList runat="server" ID="ddlCate">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <asp:Label runat="server" ID="lblPCode" Text="Mã sách :"></asp:Label>
                                </th>
                                <td>
                                    <asp:TextBox runat="server" ID="txtPCode"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <asp:Label runat="server" ID="lblPName" Text="Tên sách :"></asp:Label>
                                </th>
                                <td>
                                    <asp:TextBox runat="server" ID="txtPName" Width="300px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <asp:Label runat="server" ID="lblImg" Text="Hình ảnh :"></asp:Label>
                                </th>
                                <td>
                                    <asp:FileUpload runat="server" ID="filePImg" Width="217px" />
                                    <asp:Label runat="server" ID="lblFile" Visible="true"></asp:Label>
                                    <asp:Image ID="PImgEdit" runat="server" Width="80px" Height="80px" />
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <asp:Label runat="server" ID="lblPPrice" Text="Giá bán :"></asp:Label>
                                </th>
                                <td>
                                    <asp:TextBox runat="server" ID="txtPPice"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <asp:Label runat="server" ID="lblSaleOff" Text="Giảm giá :"></asp:Label>
                                </th>
                                <td>
                                    <asp:TextBox runat="server" ID="txtSaleOff"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <asp:Label runat="server" ID="lblAuthor" Text="Tác giả :"></asp:Label>
                                </th>
                                <td>
                                    <asp:TextBox runat="server" ID="txtAuthor" Width="300px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <asp:Label runat="server" ID="lblStatus" Text="Trạng thái"></asp:Label>
                                </th>
                                <td>
                                    <asp:TextBox runat="server" ID="txtStatus"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <asp:Label runat="server" ID="lblPActive" Text="Hiển thị :"></asp:Label>
                                </th>
                                <td>
                                    <asp:CheckBox runat="server" ID="chkPActive" />
                                </td>
                            </tr>
                            <tr style="margin-top: 20px; float: left">
                                <td align="center" colspan="2" style="float: left">
                                    <asp:Button runat="server" ID="btnSaveB" OnClick="Save_Click" Text="Save" />
                                    <asp:Button runat="server" ID="btnBackB" OnClick="Back_Click" Text="Back" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </div>
                <!-- end of right content-->
            </div>
            <!--end of center content -->
            <div class="clear">
            </div>
        </div>
        <!--end of main content-->
        <div class="footer">
            <div class="left_footer">
                SBooks 2012<a href="http://indeziner.com"></a></div>
        </div>
    </div>
    </form>
</body>
</html>
